package demo

import (
    "fmt"
    "io/ioutil"

    aepapi "gitee.com/dell_software_department/ctwing_sdk/apis/Aep_mq_sub"
)

func QueryServiceState_Demo() {
    resp, err := aepapi.QueryServiceState("dFI1lzE0EN2", "xQcjrfNLvQ")

    if err != nil {
        fmt.Println("QueryServiceState err:", err)
        return
    }
    fmt.Println("code:", resp.StatusCode, "\nerr:", err)
    bodyStr, err1 := ioutil.ReadAll(resp.Body)
    if err1 != nil {
        fmt.Println("ioutil.ReadAll err:", err1)
        return
    }
    fmt.Println(string(bodyStr))

    defer resp.Body.Close()
}
func OpenMqService_Demo() {
    resp, err := aepapi.OpenMqService("dFI1lzE0EN2", "xQcjrfNLvQ", "{}")

    if err != nil {
        fmt.Println("OpenMqService err:", err)
        return
    }
    fmt.Println("code:", resp.StatusCode, "\nerr:", err)
    bodyStr, err1 := ioutil.ReadAll(resp.Body)
    if err1 != nil {
        fmt.Println("ioutil.ReadAll err:", err1)
        return
    }
    fmt.Println(string(bodyStr))

    defer resp.Body.Close()
}
func CreateTopic_Demo() {
    resp, err := aepapi.CreateTopic("dFI1lzE0EN2", "xQcjrfNLvQ", "{}")

    if err != nil {
        fmt.Println("CreateTopic err:", err)
        return
    }
    fmt.Println("code:", resp.StatusCode, "\nerr:", err)
    bodyStr, err1 := ioutil.ReadAll(resp.Body)
    if err1 != nil {
        fmt.Println("ioutil.ReadAll err:", err1)
        return
    }
    fmt.Println(string(bodyStr))

    defer resp.Body.Close()
}
func QueryTopicInfo_Demo() {
    resp, err := aepapi.QueryTopicInfo("dFI1lzE0EN2", "xQcjrfNLvQ", "")

    if err != nil {
        fmt.Println("QueryTopicInfo err:", err)
        return
    }
    fmt.Println("code:", resp.StatusCode, "\nerr:", err)
    bodyStr, err1 := ioutil.ReadAll(resp.Body)
    if err1 != nil {
        fmt.Println("ioutil.ReadAll err:", err1)
        return
    }
    fmt.Println(string(bodyStr))

    defer resp.Body.Close()
}
func QueryTopicCacheInfo_Demo() {
    resp, err := aepapi.QueryTopicCacheInfo("dFI1lzE0EN2", "xQcjrfNLvQ", "")

    if err != nil {
        fmt.Println("QueryTopicCacheInfo err:", err)
        return
    }
    fmt.Println("code:", resp.StatusCode, "\nerr:", err)
    bodyStr, err1 := ioutil.ReadAll(resp.Body)
    if err1 != nil {
        fmt.Println("ioutil.ReadAll err:", err1)
        return
    }
    fmt.Println(string(bodyStr))

    defer resp.Body.Close()
}
func QueryTopics_Demo() {
    resp, err := aepapi.QueryTopics("dFI1lzE0EN2", "xQcjrfNLvQ")

    if err != nil {
        fmt.Println("QueryTopics err:", err)
        return
    }
    fmt.Println("code:", resp.StatusCode, "\nerr:", err)
    bodyStr, err1 := ioutil.ReadAll(resp.Body)
    if err1 != nil {
        fmt.Println("ioutil.ReadAll err:", err1)
        return
    }
    fmt.Println(string(bodyStr))

    defer resp.Body.Close()
}
func ChangeTopicInfo_Demo() {
    resp, err := aepapi.ChangeTopicInfo("dFI1lzE0EN2", "xQcjrfNLvQ", "", "{}")

    if err != nil {
        fmt.Println("ChangeTopicInfo err:", err)
        return
    }
    fmt.Println("code:", resp.StatusCode, "\nerr:", err)
    bodyStr, err1 := ioutil.ReadAll(resp.Body)
    if err1 != nil {
        fmt.Println("ioutil.ReadAll err:", err1)
        return
    }
    fmt.Println(string(bodyStr))

    defer resp.Body.Close()
}
func QuerySubRules_Demo() {
    resp, err := aepapi.QuerySubRules("dFI1lzE0EN2", "xQcjrfNLvQ", "{}")

    if err != nil {
        fmt.Println("QuerySubRules err:", err)
        return
    }
    fmt.Println("code:", resp.StatusCode, "\nerr:", err)
    bodyStr, err1 := ioutil.ReadAll(resp.Body)
    if err1 != nil {
        fmt.Println("ioutil.ReadAll err:", err1)
        return
    }
    fmt.Println(string(bodyStr))

    defer resp.Body.Close()
}
func ChangeSubRules_Demo() {
    resp, err := aepapi.ChangeSubRules("dFI1lzE0EN2", "xQcjrfNLvQ", "{}")

    if err != nil {
        fmt.Println("ChangeSubRules err:", err)
        return
    }
    fmt.Println("code:", resp.StatusCode, "\nerr:", err)
    bodyStr, err1 := ioutil.ReadAll(resp.Body)
    if err1 != nil {
        fmt.Println("ioutil.ReadAll err:", err1)
        return
    }
    fmt.Println(string(bodyStr))

    defer resp.Body.Close()
}
func ClosePushService_Demo() {
    resp, err := aepapi.ClosePushService("dFI1lzE0EN2", "xQcjrfNLvQ")

    if err != nil {
        fmt.Println("ClosePushService err:", err)
        return
    }
    fmt.Println("code:", resp.StatusCode, "\nerr:", err)
    bodyStr, err1 := ioutil.ReadAll(resp.Body)
    if err1 != nil {
        fmt.Println("ioutil.ReadAll err:", err1)
        return
    }
    fmt.Println(string(bodyStr))

    defer resp.Body.Close()
}
